package com.minelx.datamicroscope.core.query;

import java.util.Objects;

public final class ResourceMapping {

	private final String name;

	private final Resource resource;

	public ResourceMapping(String name, Resource resource) {
		this.name = name;
		this.resource = resource;
	}

	public String name() {
		return name;
	}

	public Resource resource() {
		return resource;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == this) return true;
		if (obj == null || obj.getClass() != this.getClass()) return false;
		ResourceMapping that = (ResourceMapping) obj;
		return Objects.equals(this.name, that.name) &&
				Objects.equals(this.resource, that.resource);
	}

	@Override
	public int hashCode() {
		return Objects.hash(name, resource);
	}

	@Override
	public String toString() {
		return "ResourceFileMapping{" +
				"resourceName='" + name + '\'' +
				", resourceFile=" + resource +
				'}';
	}
}
